<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>密码修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="layui/dist/css/layui.css"  media="all">
    <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#change").click(function(){
                var user_id=$("#user_id").val();
                var password_old=$("#password_old").val();
                var password_new_1 = $("#password_new_1").val();
                var password_new_2 = $("#password_new_2").val();
                if(user_id==""){
                    alert("请输入用户名！！！");
                    $("#msg").text("请输入用户名！！！");
                    return false;
                }
                if(password_old==""){
                    alert("请输入原始密码！！！");
                    $("#msg").text("请输入原始密码！！！");
                    return false;
                }
                if(password_new_1==""){
                    alert("请输入新密码！！！");
                    $("#msg").text("请输入新密码！！！");
                    return false;
                }
                if(password_new_2==""){
                    alert("请确认新密码！！！");
                    $("#msg").text("请确认新密码！！！");
                    return false;
                }
                if(password_new_2!=password_new_1){
                    alert("两次新密码不一致");
                    $("#msg").text("两次新密码不一致");
                    return false;
                }
                if(password_old==password_new_1){
                    alert("新旧密码一致");
                    $("#msg").text("新旧密码一致");
                    return false;
                }
            });
            $("#cancel").click(function () {
                window.location.href="login";

            })
        });

    </script>
</head>
<body>
<div style="margin: 0 auto; width:60%">
    <form class="layui-form" action="changeUser" method="post" lay-filter="example">
        <h1 style="color: #1E9FFF;text-align: center;margin-top: 100px;margin-bottom: 50px">密码修改</h1>

        <div class="layui-form-item">
            <label class="layui-form-label">用户名：</label>
            <div class="layui-input-block">
                <input type="text" name="user_id" id="user_id" lay-verify="title" autocomplete="off" placeholder="请输入用户名" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">原始密码：</label>
            <div class="layui-input-block">
                <input type="text" name="password_old" id="password_old" lay-verify="title" autocomplete="off" placeholder="请输入原始密码" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">新密码：</label>
            <div class="layui-input-block">
                <input type="text" name="password_new_1" id="password_new_1" lay-verify="title" autocomplete="off" placeholder="请输入新密码" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">确认新密码：</label>
            <div class="layui-input-block">
                <input type="password" name="password_new_2" id="password_new_2" placeholder="请再次输入新密码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <p style="height: 40px;text-align: center;color: red"><span  id="msg" th:text="${msg}"></span></p>

        <div class="layui-form-item">
            <div style="text-align: center">

                <button type="submit" class="layui-btn layui-btn-normal" id="change" >修改</button>
                <button type="button" class="layui-btn layui-btn-warm" id="cancel" >取消</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>
